

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>网站设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/admin/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/admin/layuiadmin/style/admin.css" media="all">
</head>
<body>
<form class="layui-form" action="/admin/set/smssite" method="post">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">短信设置</div>
                    <div class="layui-card-body">
                        <div class="layui-form-item" lay-filter="sex">
                            <label class="layui-form-label">短信接口</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sms_sendtype" value="1" title="腾讯云" {if condition="isset($setres.sms_sendtype) && $setres.sms_sendtype==1"} checked {/if}>
                                <input type="radio" name="sms_sendtype" value="2"  title="阿里云" {if condition="isset($setres.sms_sendtype) && $setres.sms_sendtype==2"} checked {/if}><!--checked-->
                                <input type="radio" name="sms_sendtype" value="3"  title="短信宝" {if condition="isset($setres.sms_sendtype) && $setres.sms_sendtype==3"} checked {/if}>
                                <input type="radio" name="sms_sendtype" value="4"  title="聚合短信" {if condition="isset($setres.sms_sendtype) && $setres.sms_sendtype==4"} checked {/if}>
                            </div>
                            <div class="layui-form-mid layui-word-aux">注册申请地址
                                <a target="_blank" href="http://www.smsbao.com/reg?r=11120">短信宝</a>
                                <a target="_blank" href="https://chuangke.aliyun.com/invite?userCode=bf2114tk">阿里云</a>
                                <a style="color:#5FB878;" target="_blank" href="https://cloud.tencent.com/redirect.php?redirect=10068&cps_key=00e015892b5a2e92c5f672590be127aa">腾讯云</a>
                                <a target="_blank" href="https://www.juhe.cn/">聚合短信</a>
                            </div>
                        </div>
                        <div class="layui-form-item" id="sms_appid">
                            <label class="layui-form-label">短信AppID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_appid"  value="{if condition="isset($setres.sms_appid)"}{$setres.sms_appid}{/if}" placeholder="短信AppID（必填项）" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">appid</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">短信AppKey</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_appkey"  value="{if condition="isset($setres.sms_appkey)"}{$setres.sms_appkey}{/if}" placeholder="短信AppKey（必填项）" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">都需要填</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">登录验证码模版ID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_login_temid"  value="{if condition="isset($setres.sms_login_temid)"}{$setres.sms_login_temid}{/if}" placeholder="模版ID（必填项）" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">发送短信用的模板</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">注册验证码模版ID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_reg_temid"  value="{if condition="isset($setres.sms_reg_temid)"}{$setres.sms_reg_temid}{/if}" placeholder="模版ID（必填项）" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">发送短信用的模板</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">找回密码验证码模版ID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_back_temid"  value="{if condition="isset($setres.sms_back_temid)"}{$setres.sms_back_temid}{/if}" placeholder="模版ID（必填项）" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">发送短信用的模板 （三个模板id可以用一个模板）</div>
                        </div>
                        <div class="layui-form-item" style="display: none;" id="sms_sign">
                            <label class="layui-form-label">短信签名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_sign"  value="{if condition="isset($setres.sms_sign)"}{$setres.sms_sign}{/if}" placeholder="短信签名" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">阿里云和短信宝使用，腾讯云用户无需考虑此项（腾讯云、聚合不用填）</div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="submit" class="layui-btn" value="确认保存">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    </div>
</form>

<script src="/admin/layuiadmin/layui/layui.js"></script>
<script src="/admin/layuiadmin/jq/jquery.js"></script>
<script>
    layui.config({
        base: '/admin/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','layedit'], function(){
        var $ = layui.$
            ,form = layui.form
            ,upload = layui.upload,layedit = layui.layedit;


        form.on('radio', function(data) {
            var va = data.elem.value;
            if(va==1){
                $("#sms_sign").hide();//签名
                $("#sms_appid").show();//appid
            }else if(va==2){
                $("#sms_sign").show();//签名
                $("#sms_appid").show();//appid
            }else if(va==3){
                $("#sms_sign").show();//签名
                $("#sms_appid").show();//appid
            }else if(va==4){
                $("#sms_sign").hide();//签名
                $("#sms_appid").hide();//appid
            }
            console.log(va);
        });


        upload.render({
            elem: '#layuiadmin-upload-useradmin' //绑定元素
            ,url: "{:url('/admin/Index/upload')}" //上传接口
            ,ext: 'jpg|png|gif'//限制文件
            ,done: function(res){
                //上传完毕回调
                $(this.item).prev("div").children("input").val(res.filename);
                document.getElementById('img1').src = res.filename;
                layer.msg("上传成功");
            }
            ,error: function(){
                //请求异常回调
            }

        });


    })
</script>
</body>
</html>